package topcbl.adapter;

import topcbl.taxi.R;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class NavigationDrawerAdapter extends ArrayAdapter<String> {
	Context context;
	String[] item;
	int imageResource[] = { android.R.color.transparent, R.drawable.login,
			R.drawable.magsearch, R.drawable.icon_favorite, R.drawable.history,
			R.drawable.taxi_driver_icon };

	public NavigationDrawerAdapter(Context context, int resource,
			String[] navigation_item) {
		super(context, resource, navigation_item);
		this.context = context;
		this.item = navigation_item;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = LayoutInflater.from(context);
		convertView = inflater.inflate(R.layout.row_navigation_drawer, null);
		ImageView icon = (ImageView) convertView
				.findViewById(R.id.navigation_image);
		TextView text = (TextView) convertView
				.findViewById(R.id.navigation_text);
		icon.setImageResource(imageResource[position]);
		text.setText(item[position]);
		if (position == 0){
			convertView.setBackgroundResource(R.drawable.acc_navigation);
		}
		return convertView;
	}

	@Override
	public int getCount() {
		return item.length;
	}
}
